import { Controller,Get,Post ,Body} from '@nestjs/common';
import { HttpResponse } from 'src/types/http_response.interface';
import { ProductImageService } from 'src/services/product_image/product_image.service';
import { ProductImage } from 'src/types/product_image.interface';
@Controller('product-image')
export class ProductImageController {
    constructor(private readonly productImageService:ProductImageService){

    }
    @Get()
    async findAllActive():Promise<HttpResponse<ProductImage[]>>{
        const data = await this.productImageService.findAllActive();
        return {
            success:true,
            message:'返回所有的商品图片成功',
            data
        }
    }
    @Post()
    async create(
        @Body() createProductImageDto:ProductImage|ProductImage[]
    ):Promise<HttpResponse<ProductImage|ProductImage[]>>{
        const data = await this.productImageService.create(createProductImageDto);
        return {
            success:true,
            message:'商品图片添加成功',
            data
        }
    }
}
